import { ref, computed } from "vue";
import { defineStore } from "pinia";

// 你甚至可以使用一个函数（类似于一个组件setup()）来为更高级的用例定义一个Store：
export const useCounterStore = defineStore({
  id: "counter",
  state: () => ({
    account: {
      name: "",
      password: "",
    },
    userInfo: {},
    token: "",
    tenantCode: "",
    userCode: "",
  }),
  actions: {
    ACCOUNT_ACTION(data) {
      this.account = data;
    },
    USER_ACTION(data) {
      this.userInfo = data;
    },
    TOKEN_ACTION(data) {
      this.token = data;
    },
    userCode_ACTION(d) {
      this.userCode = d;
    },
    tenantCode_ACTION(d) {
      this.tenantCode = d;
    },
    CLEAR_ACTION(d) {
      this.userInfo = d;
      // this.token = '';
    },
  },
});
